﻿using System.ComponentModel.DataAnnotations;
using Microsoft.CTP.CommerceAPI.SDKSample.Client.Utils;

namespace TestWebApplication
{
    public class PurchaseContentViewModel
    {
        private ContentCatalogViewModel _contentCatalog;
        public ContentCatalogViewModel ContentCatalog
        {
            get
            {
                if (_contentCatalog == null)
                {
                    _contentCatalog = new ContentCatalogViewModel();
                }
                return _contentCatalog;
            }
            set
            {
                _contentCatalog = value;
            }
        }

        // "Credit Card" Or "Mobile Phone"
        public string PIType { get; set; }

        public string CreditCardPaymentMethodId { get; set; }

        private MobilePhonePaymentMethodViewModel _moPI;
        public MobilePhonePaymentMethodViewModel MobilePhonePaymentMethod
        {
            get
            {
                if (_moPI == null)
                {
                    _moPI = new MobilePhonePaymentMethodViewModel();
                }
                return _moPI;
            }
            set
            {
                _moPI = value;
            }
        }
    }

    public class ContentCatalogViewModel
    {
        [Required(ErrorMessage = "Content Category is required.")]
        [Display(Name = "Content Category")]
        public string ContentCategory { get; set; }

        [Required(ErrorMessage = "License Type is required.")]
        [Display(Name = "License Type")]
        public string LicenseType { get; set; }

        [Required(ErrorMessage = "Entitlement Type is required.")]
        [Display(Name = "Entitlement Type")]
        public string EntitlementType { get; set; }

        [Required(ErrorMessage = "Quantity is required.")]
        [Display(Name = "Quantity")]
        public int Quantity { get; set; }
        
        [Required(ErrorMessage = "Content name is required.")]
        [Display(Name = "contentName")]
        public string contentName { get; set; }

        [Required(ErrorMessage = "Content amount is required.")]
        [Display(Name = "contentAmount")]
        public decimal contentAmount { get; set; }
    }

    public class MobilePhonePaymentMethodViewModel
    {
        [Required(ErrorMessage = "Mobile Operator is required.")]
        [Display(Name = "Mobile Operator")]
        public string MobileOperatorId { get; set; }

        [Display(Name = "Mobile Phone Number")]
        public string PhoneNumber { get; set; }

        [Required(ErrorMessage = "Billing Token is required.")]
        [Display(Name = "Billing Token")]
        public string BillingToken { get; set; }
    }
}